package org.sci4j.maths;

/**
 *   sci4j - Java library for scientific computation.
 *   
 *   Copyright (C) 2010 Inaki Ortiz de Landaluce
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
public class ComplexArray2D {
	
	private double[] data;
	private int n;
	private int m;
		
	public ComplexArray2D(int n, int m) {
		data = new double[2*m*n];
		this.n = n;
		this.m = m;
	}
	
	public Complex get(int i, int j) {
		return new Complex(data[2*(i*n+j)],data[2*(i*n+j)+ 1]);
	}
	
	public void set(int i, int j, Complex z) {
		data[2*(i*n + j)] = z.re;
		data[2*(i*n + j) + 1] = z.im;
	}
	
	public int length() {
		return n*m;
	}
	
	public int getRowNum() {
		return n; 
	}
	
	public int getColNum() {
		return m; 
	}	
}
